<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"></script>
    <div id="box">
        <div v-html="namea" v-bind:class="lei"></div>
        <div v-text="nameb"></div>
        <img v-bind:src="url">
        <p v-if="true">aaa</p>
        <p v-show="true">bbb</p>
        <p v-if="false">if隐藏</p>
        <p v-show="false">show隐藏</p>
        <div v-if="num>5">{{num}}</div>
        <div v-else="">{{num}}</div>
        <div v-for="(item,index) in arr" :key="index">{{item.name}}</div>
        <div v-for="(value,key,index) in obj" :key="key">{{value}}</div>
        <div v-for="item in 10">{{item}}</div>
        <input type="text" v-model.number="abs">{{abs+10}}
        <input type="text" v-model.lazy="abm">{{abm+10}}
        <input type="text" v-model.trim="abz">{{abz+10}}
        <button v-on:click="fn()">打印</button>

        
        <ul>
            <li v-for="(value,key,index) in obj" :key="index" v-color="index">{{key}}</li>
        </ul>
    </div>
    <script>
        Vue.directive("color", function (element, binding) {
            if (binding.value % 2 == 0) {
                element.style.backgroundColor = "red"
            } else {
                element.style.backgroundColor = "yellow"
            }
        })


        new Vue({
            el: "#box",
            data: {
                abs: "",
                abm: "",
                abz: "",
                namea: 111,
                nameb: 222,
                url: "https://tse4-mm.cn.bing.net/th/id/OIP-C.tHAIAaw4ZNlr4v2ldAkvYwHaHa?w=185&h=185&c=7&r=0&o=7&dpr=1.3&pid=1.7&rm=3",
                lei: "classname",
                num: 3,
                arr: [{
                    name: "三",
                    age: 18
                }],
                obj: {
                    game: "yuan",
                    time: 99
                }
            },
            methods: {
                fn: function () {
                    console.log(1);

                },
                /* fn() {
                    console.log(1);

                } */
            }
        })
    </script>
</body>

</html>